package cn.meike.net.protocol
{
	import flash.utils.ByteArray;

	public class MsgBody
	{
		public var m_stLoginServer_Request:LoginServer_Request;
		
		public function MsgBody()
		{
			m_stLoginServer_Request = null;
		}
		
		
		public function encode(select:int, buf:ByteArray, cutVersion:uint = 0):int 
		{
			if (cutVersion == 0 || cutVersion > CURRVERSION) {
				cutVersion = CURRVERSION;
			}
			
			var ret : int = ErrorMap.NO_ERROR;
			
			if (select == 101) 
			{
				if (VERSION_m_stLoginServer_Request <= cutVersion) {
					if (m_stLoginServer_Request == null) {
						return ErrorMap.ERR_REFERENCE_IS_NULL;
					}
					ret = m_stLoginServer_Request.encode(buf, cutVersion);
					if (ret != ErrorMap.NO_ERROR) {
						return ret;
					}
				}
			}
			
			return ret;
		}
		
		
		public function decode(select:int,buf:ByteArray, cutVersion:uint = 0):int 
		{
			if (cutVersion == 0 || cutVersion > CURRVERSION) {
				cutVersion = CURRVERSION;
			}
			var ret : int = ErrorMap.NO_ERROR;
			if (select == 101) 
			{
				if (VERSION_m_stLoginServer_Request <= cutVersion) {
					m_stLoginServer_Request = new LoginServer_Request();
					ret = m_stLoginServer_Request.decode(buf, cutVersion);
					if (ret != ErrorMap.NO_ERROR) {
						return ret;
					}
				}
			}
			
			return 0;
		}
		
		static public const BASEVERSION : uint = 1;
		static public const CURRVERSION : uint = 37;
		static public const VERSION_m_stLoginServer_Request : uint = 1;
		
	}
}